﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using websoniBO;

namespace websoni
{
    public partial class WebForm8 : System.Web.UI.Page
    {
        Comments c = new Comments();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = c.GetRecords(-99, " ", " ", false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
                               
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
        
            c.cid = -99;
            c.sender_name = tbname.Text;
            c.comment = tbmsg.Text.Replace(Environment.NewLine, "</br> ") + "</br>"+ DateTime.Now.DayOfWeek.ToString()+", "+DateTime.Now.ToString();
            c.isdeleted = false;
            c.SaveRecords();
            Response.Redirect("~/Comments.aspx");
            
        }

        protected void GridView1_DataBinding(object sender, EventArgs e)
        {
           
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt1 = c.GetRecords(-99, "", "", false, " and ");
            GridView1.DataSource = dt1;
            GridView1.DataBind();
        }

        
    }
}
